package com.spzx.product.service.impl;

import com.github.pagehelper.PageInfo;
import com.spzx.domain.Brand;
import com.spzx.product.mapper.BrandMapper;
import com.spzx.product.service.IBrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 品牌Service业务层处理
 */
@Service
public class BrandServiceImpl implements IBrandService {

    @Autowired
    private BrandMapper brandMapper;

    @Override
    public Brand getById(Long id) {
        return brandMapper.getById(id);
    }

    @Override
    public PageInfo<Brand> list(Integer page, Integer limit, Integer brandName) {
        return brandMapper.list(page, limit, brandName);
    }

    @Override
    public int save(Brand brand) {
        System.out.println("brand.getId() = " + brand.getId());
        int rows = brandMapper.insert(brand);
        System.out.println("brand.getId() = " + brand.getId());
        return rows;
    }

    @Override
    public int update(Brand brand) {
        return brandMapper.update(brand);
    }

    @Override
    public int delete(Brand brand) {
        return brandMapper.delete(brand);
    }

}
